package com.costeaalex.blueserver.threads;

import com.costeaalex.blueserver.bluecove.BlueCoveServer;
import com.costeaalex.blueserver.communication.CommunicationManager;
import com.costeaalex.blueserver.timeout.TimeoutProcess;

public class StartBlueCoveServer extends Thread implements TimeoutProcess
	{
	
	private BlueCoveServer bCS;
	private CommunicationManager cM;
	private boolean cancellable=true;
	private MainThread mTL;
	
	public String name="BlueCove";
	
	public StartBlueCoveServer(MainThread mT)
		{
		bCS=new BlueCoveServer();
		mTL=mT;
		}
	
	@Override
	public void run()
		{
		bCS.start();
		cancellable=false;
		cM=bCS;
		mTL.BlueCoveServerStatus(cM);
		}
	
	public void destroy()
		{
		bCS=null;
		if(cancellable)
			mTL.operationCancelled(this);
		this.interrupt();
		}

	public boolean isCancellable()
		{
		return cancellable;
		}

	public String getProcessName()
		{
		return name;
		}
	
	}
